package com.mi.rof.entity.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zwq
 */
public enum PaymentStateEnum {
    //已拉起支付
    APPLIED(0,"已拉起支付"),
    //已结算
    CLEARED(1,"已结算");


    private int code;

    private String msg;

    PaymentStateEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }


    public String getMsg() {
        return msg;
    }

    /**
     * 通过code获取枚举类
     */
    private static Map<Integer, RoleEnum> stateMap = new HashMap<>();
    private static Map<String, RoleEnum> msgMap = new HashMap<>();
    static {
        for (RoleEnum value : RoleEnum.values()) {
            stateMap.put(value.getCode(),value);
        }
    }
    static {
        for (RoleEnum value : RoleEnum.values()) {
            msgMap.put(value.getMsg(),value);
        }
    }

    public static RoleEnum getByCode(Integer code){
        return stateMap.get(code);
    }
    public static RoleEnum getByMsg(String msg){
        return msgMap.get(msg);
    }
}
